﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microhard.WeixinMP.Interfaces;
using Microhard.WeixinMP.Models;
using Microhard.WeixinMP.Unities;
using Microhard.Core;

namespace Microhard.WeixinMP.Impls
{
    public class BaseResponseImpl : IWeixinRobotResponse
    {
        protected string UrlFormat = "{0}?WeixinToken={1}&WeixinName={2}&rc={3}&cov={4}&cmpID={5}";

        private WeixinBaseData<object> CreateResponseModel(RequestServiceModel model)
        {
            WeixinBaseData<object> result = new WeixinBaseData<object>();
            result.CreateTime = DateTime.Now.CreateWeixinDateTime().ToString();
            //返回消息时，发送人与接收人需要互换
            result.FromUserName = model.ToUserName;
            result.ToUserName = model.FromUserName;
            return result;
        }

        protected virtual WeixinBaseData<object> CreateFeatureResponse(RequestServiceModel request, WeixinBaseData<object> response)
        {
            return null;
        }

        public WeixinBaseData<object> GetResponse(Models.RequestServiceModel model)
        {
            var initData = this.CreateResponseModel(model);
            return this.CreateFeatureResponse(model, initData);
        }



        public virtual WeixinCommand Command
        {
            get { return new WeixinCommand(); }
        }


        public virtual bool IsCallMe(RequestServiceModel model)
        {
            return false;
        }
    }
}
